/**
 * All Rights Reserved , Copyright (C) 2021 , 青岛鼎信通讯股份有限公司
 *
 *SdProjectTeamTypeController
 * SD项目任命-项目组分类
 *
 * 修改纪录
 * 2021-12-08 版本：1.0 wangxinhua 创建。
 * @version 版本：1.0
 * @author 作者：wangxinhua
 * 创建日期：2021-12-08
 */

package com.topscomm.gpm.controller;

import java.util.Map;

import com.topscomm.gpm.controller.auto.GpmProjectTeamTypeControllerAuto;
import com.topscomm.gpm.pojo.GpmProjectAppointmentEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.topscomm.pub.util.StringBufferProxy;
import com.topscomm.pub.util.StringUtil;
import com.topscomm.pub.vo.ResponseResult;

/**
 * @author: wangxinhua
 * @date: 2021-12-08
 * @description:SD项目任命-项目组分类Controller
 * @modify:
 */
@RestController
@RequestMapping("sd/projectTeamType")
public class GpmProjectTeamTypeController extends GpmProjectTeamTypeControllerAuto implements IGpmProjectTeamTypeController {
	/**
	 * @author: wangxinhua
	 * @date: 2021-12-08
	 * @param paraMap
	 * @return
	 * @description:转换出查询SQL语句
	 * @modify:
	 */
	@Override
	protected String spellListSql(Map<String, Object> paraMap) {
		StringBufferProxy sql = new StringBufferProxy();
		sql.appendSingle(" 1=1 ");
		if (paraMap.containsKey("qry_name")) {
			String value = paraMap.get("qry_name").toString();
			if (!StringUtil.isEmpty(value))
				sql.appendSingle(" and name like '%{0}%' ", value);
		}
		if (paraMap.containsKey("qry_code")) {
			String value = paraMap.get("qry_code").toString();
			if (!StringUtil.isEmpty(value))
				sql.appendSingle(" and code = '{0}' ", value);
		}
		if (paraMap.containsKey("appointmentId")) {
			String value = paraMap.get("appointmentId").toString();
			if (!StringUtil.isEmpty(value))
				sql.appendSingle(" and appointmentid = {0} ", value);
		}
		if (paraMap.containsKey("projectCode")) {
			String value = paraMap.get("projectCode").toString();
			if (!StringUtil.isEmpty(value))
				sql.appendSingle(" and projectcode = '{0}' ", value);
		}
		if (paraMap.containsKey("qry_review_parentid")) {
			String value = paraMap.get("qry_review_parentid").toString();
			if (!StringUtil.isEmpty(value)) {
				sql.appendSingle(" and appointmentid in (select id from {0} where version = (select max(NVL(version,1)) from {0} where projectid = '{1}' and state = '9') and projectid = '{1}' )", GpmProjectAppointmentEntity.tableName,value);
			}
		}
		// sql.appendSingle(" order by sortcode asc, createon asc");
		return sql.toString();
	}

	/**
	 * @author: wangxinhua
	 * @date: 2021-12-08
	 * @param paraMap
	 * @return
	 * @description:转换出查询SQL语句
	 * @modify:
	 */
	@Override
	@GetMapping(value = "/refList")
	public ResponseResult<Object> refList(@RequestParam(required = false) Map<String, Object> paraMap) {
		return super.refList(paraMap);
	}
}

